package com.urbane.generator.model.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
@Schema(description = "代码生成请求参数")
public class GenDataSourceRequest {
    /**
     * 数据库连接URL
     * <p>
     * 示例: jdbc:mysql://localhost:3306/my-db?useUnicode=true&characterEncoding=utf8
     */
    @NotBlank(message = "数据库连接URL不能为空")
    @Schema(
            description = "数据库连接URL",
            example = "jdbc:mysql://localhost:3306/my-db?useUnicode=true&characterEncoding=utf8",
            requiredMode = Schema.RequiredMode.REQUIRED
    )
    private String dbUrl;

    /**
     * 数据库用户名
     */
    @NotBlank(message = "数据库用户名不能为空")
    @Schema(
            description = "数据库用户名",
            example = "root",
            requiredMode = Schema.RequiredMode.REQUIRED
    )
    private String dbUsername;

    /**
     * 数据库密码
     * <p>
     * 注意: 在实际生产环境中，不建议直接传递数据库密码，
     * 应该使用更安全的认证方式或配置管理
     */
    @NotBlank(message = "数据库密码不能为空")
    @Schema(
            description = "数据库密码",
            example = "password123",
            requiredMode = Schema.RequiredMode.REQUIRED
    )
    private String dbPassword;

    /**
     * 数据库驱动类名
     * <p>
     * MySQL: com.mysql.cj.jdbc.Driver
     * PostgresSQL: org.postgresql.Driver
     * Oracle: oracle.jdbc.OracleDriver
     */
    @NotBlank(message = "数据库驱动类名不能为空")
    @Schema(
            description = "数据库驱动类名",
            example = "com.mysql.cj.jdbc.Driver",
            requiredMode = Schema.RequiredMode.REQUIRED
    )
    private String dbDriverClassName;

    public enum DriverClassType {
        MYSQL,
        POSTGRESQL,
        ORACLE,
        SQLSERVER,
        DB2,
        H2,
        OTHER
    }
}
